#include "qwidgetfactory.h"

QList<QWidgetPluginInterface*> WidgetFactory::m_plugins;

WidgetFactory::WidgetFactory()
{
}


void WidgetFactory::addPlugin(QWidgetPluginInterface *plugin)
{
    m_plugins.append(plugin);
}

QWidget* WidgetFactory::create(const QString &name)
{
    QWidget *ret=NULL;
    foreach(QWidgetPluginInterface *factory,m_plugins)
    {
        ret=factory->createWidget(name,NULL);
        if(ret!=NULL)
        {
            return ret;
        }
    }
    return NULL;
}

QList<QWidgetPluginInterface*>  WidgetFactory::interface()
{
    return m_plugins;
}
